package pers.mtx.hmw.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import pers.mtx.hmw.entity.Users;
import pers.mtx.hmw.mapper.UsersMapper;
import pers.mtx.hmw.service.UsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author mtx
 * @since 2022-03-17
 */
@Service
public class UsersServiceImmpl extends ServiceImpl<UsersMapper, Users> implements UsersService {

    @Autowired
    UsersMapper usersMapper;

    @Override
    public Users checkUser(String username, String password) {
        QueryWrapper<Users> wrapper = new QueryWrapper<>();
        wrapper.eq("username",username);
        Users one = usersMapper.selectOne(wrapper);
        if (one!=null&& one.getPassword().equals(password)){
            return one;
        }
        return null;
    }
}
